package com.nintendo.utils;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

import java.time.Duration;

public class JedisPoolUtil {
    private static final JedisPool jedisPool;
    static {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxTotal(10);
        jedisPoolConfig.setMaxIdle(10);
        jedisPoolConfig.setMinIdle(5);
        jedisPoolConfig.setMaxWait(Duration.ofMillis(1500));
        jedisPool = new JedisPool(jedisPoolConfig, "39.105.159.64", 6379,1000,"YJQ.icu8888");
    }
    public static Jedis getJedis() {
        return jedisPool.getResource();
    }
}
